from collections.abc import Iterable
from typing import TypeVar

from zkl_aiutils_datasets.basics import DatasetIterator

AnySample = TypeVar('AnySample')


class IteratorIterator(DatasetIterator[AnySample]):
    def __init__(self, iterator: Iterable[AnySample]):
        self._iterator = iter(iterator)

    def __next__(self) -> AnySample:
        return next(self._iterator)
